<?php
$accept = array(
    'html' => 40,
    'xhml' => 90,
    'xml'  => 20,
    'txt'  => 20,
    'jpg'  => 100
);

foreach($accept as $mimetype => $preference) {
    $result[(int) $preference][] = $mimetype;
}
krsort($result);

var_dump($result);
var_dump($accept);